home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / tnos / tnos100s / vmsmgr.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-13  |  1.2 KB  |  53 lines

  1. #include "vmsmgr.hpp"
  2.  
  3. vmsmgr::vmsmgr(unsigned long the_size, unsigned long num_elements)
  4.     : dmsmgr (the_size, num_elements)          // numelements defaults to 1
  5. {
  6.     int inK;
  7.     
  8.     installed = TRUE;
  9.     memory = FALSE;
  10.     inK = ((the_size * num_elements) / 1024) + 1;
  11.     if (xmsmgr::is_installed())    {    // got extended memory!
  12.         XMSindex = alloc_emb (inK);
  13.         if (xmsmgr::is_installed())    {    // alloc okay?
  14.             memory = TRUE;
  15.             return;
  16.             }
  17.     }
  18.     alloc_dmb ();
  19.     installed = (dmsmgr::is_installed()) ? TRUE : FALSE;
  20.     return;
  21. }
  22.  
  23. char* vmsmgr::vmserr()
  24. {
  25.     return ((memory == TRUE) ? xmserr() : dmserr());
  26. }
  27.  
  28. Boolean vmsmgr::stow (char far* send, size_t listnum)
  29. {
  30. Boolean retval;
  31.  
  32.     if (!is_installed())
  33.         return FALSE;
  34.     if (memory)
  35.         retval = xmsmgr::stow (send, XMSindex, thesize, (unsigned long) (thesize * listnum));
  36.     else
  37.         retval = dmsmgr::stow (send, listnum);
  38.     return retval;
  39. }
  40.  
  41. Boolean vmsmgr::fetch (char far* receive, size_t listnum)
  42. {
  43. Boolean retval;
  44.  
  45.     if (!is_installed())
  46.         return FALSE;
  47.     if (memory)
  48.         retval = xmsmgr::fetch (receive, XMSindex, thesize, (unsigned long) (thesize * listnum));
  49.     else
  50.         retval = dmsmgr::fetch (receive, listnum);
  51.     return retval;
  52. }
  53.